<%--
  Created by IntelliJ IDEA.
  User: 张思成
  Date: 2022/5/7
  Time: 10:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>注册</title>
    <script src="js/jquery-3.6.0.js"></script>
    <script>
        $(function (){
            $("#username").blur(function (){
                //获取输入的账号
                var  un=$(this).val();
                //发送Ajax请求
                $.post("registerServlet",{"username":un},function (obj){
                   console.log(obj);
                   if (!obj){
                       $("#un_msg").text("账号已被注册，请重新输入");
                   }
                },"json");
            });
        });
    </script>
</head>
<body>
<form action="" method="">
    账号:<input type="text" name="username" id="username">
    <span style="color: red" id="un_msg"></span><br>
    密码:<input type="password" name="password"><br>
    <input type="submit" value="注册">
</form>
</body>
</html>
